﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ecdl.demo.persistence;

namespace ecdl.demo.model.expression {
    public class ExpressionPersistenceContributor : IPersistenceContributor {
        public void ContributeTypesTypes(DTODeserializer serializer) {
            serializer.AddExpressionElementAttribute(typeof(AndDTO), "And");
            serializer.AddExpressionElementAttribute(typeof(OrDTO), "Or");
            serializer.AddExpressionElementAttribute(typeof(NotDTO), "Not");
        }

        public void ContributeOverrides(DTODeserializer serializer) {
            serializer.AddAttributeOverride(typeof(NotDTO), "Expression", serializer.GetExpressionXmlElementAttributes());
            serializer.AddAttributeOverride(typeof(SingleExpressionDTO), "Expression", serializer.GetExpressionXmlElementAttributes());
            serializer.AddAttributeOverride(typeof(MultiExpressionDTO), "Expressions", serializer.GetExpressionXmlArrayAttributes());
        }
    }
}
